/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fpt.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author TuanAnh
 */
@Entity
@Table(name = "RentDetail")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RentDetail.findAll", query = "SELECT r FROM RentDetail r"),
    @NamedQuery(name = "RentDetail.findByReserDetailId", query = "SELECT r FROM RentDetail r WHERE r.reserDetailId = :reserDetailId"),
    @NamedQuery(name = "RentDetail.findByDate", query = "SELECT r FROM RentDetail r WHERE r.date = :date"),
    @NamedQuery(name = "RentDetail.findByNumber", query = "SELECT r FROM RentDetail r WHERE r.number = :number")})
public class RentDetail implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "reserDetailId")
    private String reserDetailId;
    @Size(max = 10)
    @Column(name = "date")
    private String date;
    @Column(name = "number")
    private Integer number;
    @OneToMany(mappedBy = "reserDetailId")
    private Collection<BillAll> billAllCollection;
    @JoinColumn(name = "serviceId", referencedColumnName = "serviceId")
    @ManyToOne
    private Services serviceId;
    @JoinColumn(name = "roomId", referencedColumnName = "roomID")
    @ManyToOne(optional = false)
    private Room roomId;
    @JoinColumn(name = "customerId", referencedColumnName = "customerId")
    @ManyToOne
    private Customer customerId;

    public RentDetail() {
    }

    public RentDetail(String reserDetailId) {
        this.reserDetailId = reserDetailId;
    }

    public String getReserDetailId() {
        return reserDetailId;
    }

    public void setReserDetailId(String reserDetailId) {
        this.reserDetailId = reserDetailId;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @XmlTransient
    public Collection<BillAll> getBillAllCollection() {
        return billAllCollection;
    }

    public void setBillAllCollection(Collection<BillAll> billAllCollection) {
        this.billAllCollection = billAllCollection;
    }

    public Services getServiceId() {
        return serviceId;
    }

    public void setServiceId(Services serviceId) {
        this.serviceId = serviceId;
    }

    public Room getRoomId() {
        return roomId;
    }

    public void setRoomId(Room roomId) {
        this.roomId = roomId;
    }

    public Customer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Customer customerId) {
        this.customerId = customerId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reserDetailId != null ? reserDetailId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RentDetail)) {
            return false;
        }
        RentDetail other = (RentDetail) object;
        if ((this.reserDetailId == null && other.reserDetailId != null) || (this.reserDetailId != null && !this.reserDetailId.equals(other.reserDetailId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.fpt.entity.RentDetail[ reserDetailId=" + reserDetailId + " ]";
    }
    
}
